﻿using System;
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{

    class _ISYC_308_05
    {
        public static void ISYC_308_05(Dictionary<string, Object> data)//细柄丝锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            refin.Linetype = Linetype.Dashed;
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            centre.Linetype = Linetype.DashDot;
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            double scale = 2; //放大系数


            double oal = Convert.ToDouble(data["oal"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dhub = Convert.ToDouble(data["dhub"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double l = Convert.ToDouble(data["l"]) * scale;

            //坐标
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X + oal + 4, v1.Y);
            Vector2 v3 = new Vector2(v1.X + 2, v1.Y);
            Vector2 v4 = new Vector2(v3.X, v3.Y + dhub / 2 - 0.5);
            Vector2 v5 = new Vector2(v4.X + 0.5, v4.Y + 0.5);
            Vector2 v6 = new Vector2(v3.X + oal / 2.388, v5.Y);
            Vector2 v7 = new Vector2(v6.X, v6.Y * -1);
            Vector2 v8 = new Vector2(v5.X, v5.Y * -1);
            Vector2 v9 = new Vector2(v4.X, v4.Y * -1);
            Vector2 v10 = new Vector2(v6.X, v3.Y + dc / 2.098);
            Vector2 v13 = new Vector2(v3.X + oal, v3.Y + dc / 2);
            Vector2 v12 = new Vector2(v13.X - l, v13.Y);
            Vector2 v11 = new Vector2(v12.X, v10.Y);
            Vector2 v14 = new Vector2(v13.X, v13.Y - l / 1.086);
            Vector2 v15 = new Vector2(v12.X, v14.Y);
            Vector2 v16 = new Vector2(v6.X, v6.Y + dc / 71.469);
            Vector2 v22 = new Vector2(v16.X + l / 1.073, v16.Y);
            Vector2 v17 = new Vector2(v22.X - l, v22.Y);
            Vector2 v18 = new Vector2(v17.X, v17.Y + l / 1.45);
            Vector2 v19 = new Vector2(v16.X, v16.Y + l / 1.184);
            Vector2 v21 = new Vector2(v22.X, v18.Y);
            Vector2 v20 = new Vector2(v21.X - (v16.X - v18.X), v19.Y);
            Vector2 v23 = new Vector2(v10.X, v10.Y - dc / 9.414);
            Vector2 v24 = new Vector2(v10.X + oal / 2.077, v10.Y - dc / 10.034);
            Vector2 v41 = new Vector2(v24.X, v14.Y);
            Vector2 v28 = new Vector2(v41.X, v41.Y - dc / 3);
            Vector2 v25 = new Vector2(v28.X, v6.Y);
            Vector2 v26 = new Vector2(v3.X + oal / 1.037, v25.Y);
            Vector2 v27 = new Vector2(v26.X, v28.Y);
            Vector2 v29 = new Vector2(v14.X - l / 14.615, v27.Y);
            Vector2 v30 = new Vector2(v29.X, v29.Y - l / 1.949);
            Vector2 v31 = new Vector2(v30.X - l, v30.Y);
            Vector2 v32 = new Vector2(v29.X - l / 1.101, v29.Y);
            Vector2 v33 = new Vector2(v6.X + oal / 9.578, v32.Y);
            Vector2 v34 = new Vector2(v6.X + oal / 30.786, v3.Y);
            Vector2 v35 = new Vector2(v6.X, v34.Y);
            Vector2 v36 = new Vector2(v35.X, v35.Y + dc / 31.836);
            Vector2 v37 = new Vector2(v34.X, v36.Y);
            Vector2 v38 = new Vector2(v37.X, v37.Y + dc / 12.828);
            Vector2 v39 = new Vector2(v28.X - oal / 47.889, v37.Y + dc / 11.153);
            Vector2 v40 = new Vector2(v39.X, v28.Y);
            Vector2 v42 = new Vector2(v7.X, v7.Y - dc / 71.469);
            Vector2 v43 = new Vector2(v17.X, v42.Y - l / 11.875);
            Vector2 v44 = new Vector2(v43.X, v43.Y - l / 4.578);
            Vector2 v45 = new Vector2(v44.X + l, v44.Y);
            Vector2 v46 = new Vector2(v45.X, v43.Y);
            Vector2 v47 = new Vector2(v46.X - (v42.X - v43.X), v42.Y);
            Vector2 v48 = new Vector2(v37.X, v42.Y);
            Vector2 v49 = new Vector2(v48.X, v48.Y + dc / 28.942);
            Vector2 v50 = new Vector2(v39.X, v46.Y + dc / 18.051);
            Vector2 v51 = new Vector2(v50.X, v46.Y);
            Vector2 v52 = new Vector2(v7.X, v44.Y);
            Vector2 v53 = new Vector2(v52.X, v52.Y - dc / 4.726);
            Vector2 v54 = new Vector2(v48.X, v53.Y);
            Vector2 v55 = new Vector2(v54.X, v54.Y + l / 4.578);
            Vector2 v56 = new Vector2(v25.X, v55.Y);
            Vector2 v57 = new Vector2(v56.X, v56.Y - l / 5.507);
            Vector2 v58 = new Vector2(v57.X - l / 1.158, v57.Y);
            Vector2 v59 = new Vector2(v58.X - l / 11.875, v58.Y - l / 13.103);
            Vector2 v60 = new Vector2(v54.X, v59.Y);
            Vector2 v63 = new Vector2(v44.X, v3.Y - dc / 2);
            Vector2 v62 = new Vector2(v63.X, v63.Y + l / 1.836);
            Vector2 v61 = new Vector2(v52.X, v62.Y);
            Vector2 v64 = new Vector2(v63.X + l, v63.Y);
            Vector2 v65 = new Vector2(v64.X, v57.Y);
            Vector2 v66 = new Vector2(v56.X, v51.Y - dc / 22.025);
            Vector2 v67 = new Vector2(v66.X, v46.Y);
            Vector2 v68 = new Vector2(v67.X, v67.Y + dc / 47.324);
            Vector2 v69 = new Vector2(v27.X, v68.Y);
            Vector2 v70 = new Vector2(v69.X, v30.Y);
            Vector2 v71 = new Vector2(v68.X, v70.Y);
            Vector2 v72 = new Vector2(v52.X, v52.Y - dc / 24.152);
            Vector2 v73 = new Vector2(v48.X, v72.Y);
            Vector2 v74 = new Vector2(v52.X + oal / 12.866, v52.Y);
            Vector2 v75 = new Vector2(v66.X, v57.Y + dc / 6.461);
            Vector2 v76 = new Vector2(v30.X, v75.Y);
            Vector2 v77 = new Vector2(v76.X, v76.Y - l / 1.131);
            Vector2 v78 = new Vector2(v75.X, v77.Y);
            Vector2 v79 = new Vector2(v12.X + l / 3.115, v12.Y - l / 3.089);
            Vector2 v80 = new Vector2(v12.X + l / 1.238, v12.Y - l / 2.901);
            Vector2 v81 = new Vector2(v12.X + l / 1.238, v12.Y - l / 1.496);
            Vector2 v82 = new Vector2(v12.X + l / 3.333, v12.Y - l / 1.508);
            Vector2 v83 = new Vector2(v18.X + l / 3.838, v18.Y - l / 4.27);
            Vector2 v84 = new Vector2(v18.X + l / 1.279, v18.Y - l / 4.176);
            Vector2 v85 = new Vector2(v18.X + l / 1.306, v18.Y - l / 2.076);
            Vector2 v86 = new Vector2(v18.X + l / 3.917, v18.Y - l / 2.123);
            Vector2 v87 = new Vector2(v31.X + l / 21.111, v31.Y);
            Vector2 v88 = new Vector2(v31.X + l / 12.258, v31.Y + l / 6.229);
            Vector2 v89 = new Vector2(v30.X - l / 13.103, v30.Y + l / 5.937);
            Vector2 v90 = new Vector2(v30.X - l / 17.143, v30.Y);
            Vector2 v91 = new Vector2(v31.X + l / 3.917, v31.Y + l / 9.743);
            Vector2 v92 = new Vector2(v31.X + l / 1.218, v31.Y + l / 11.515);
            Vector2 v93 = new Vector2(v31.X + l / 1.218, v31.Y + l / 13.571);
            Vector2 v94 = new Vector2(v31.X + l / 3.917, v31.Y + l / 11.176);
            Vector2 v95 = new Vector2(v3.X, v3.Y + dconms / 2);
            Vector2 v96 = new Vector2(v26.X, v95.Y);
            Vector2 v97 = new Vector2(v3.X, v3.Y - dconms / 2);
            Vector2 v98 = new Vector2(v96.X, v97.Y);
            Vector2 a1 = new Vector2(v14.X, v3.Y);


            //作图
            Line line1 = new Line(v1, v2);
            line1.Layer = centre;
            line1.Linetype = Linetype.DashDot;
            line1.LinetypeScale = 3;
            dxf.AddEntity(line1);

            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v5));
            line2.Vertexes.Add(new LwPolylineVertex(v8));
            line2.Vertexes.Add(new LwPolylineVertex(v9));
            line2.Vertexes.Add(new LwPolylineVertex(v4));
            line2.Vertexes.Add(new LwPolylineVertex(v5));
            line2.Vertexes.Add(new LwPolylineVertex(v6));
            line2.Vertexes.Add(new LwPolylineVertex(v7));
            line2.Vertexes.Add(new LwPolylineVertex(v8));
            line2.Vertexes.Add(new LwPolylineVertex(v7));
            line2.Vertexes.Add(new LwPolylineVertex(v16));
            fun.PolyFill(dxf, line2, 0.1, contour);

            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v18));
            line3.Vertexes.Add(new LwPolylineVertex(v21));
            line3.Vertexes.Add(new LwPolylineVertex(v20));
            line3.Vertexes.Add(new LwPolylineVertex(v19));
            line3.Vertexes.Add(new LwPolylineVertex(v18));
            line3.Vertexes.Add(new LwPolylineVertex(v17));
            line3.Vertexes.Add(new LwPolylineVertex(v22));
            line3.Vertexes.Add(new LwPolylineVertex(v21));
            fun.PolyFill(dxf, line3, 0.1, contour);

            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v19));
            line4.Vertexes.Add(new LwPolylineVertex(v10));
            line4.Vertexes.Add(new LwPolylineVertex(v11));
            line4.Vertexes.Add(new LwPolylineVertex(v15));
            line4.Vertexes.Add(new LwPolylineVertex(v14));
            line4.Vertexes.Add(new LwPolylineVertex(v13));
            line4.Vertexes.Add(new LwPolylineVertex(v12));
            line4.Vertexes.Add(new LwPolylineVertex(v11));
            fun.PolyFill(dxf, line4, 0.1, contour);

            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v23));
            line5.Vertexes.Add(new LwPolylineVertex(v24));
            line5.Vertexes.Add(new LwPolylineVertex(v41));
            line5.Vertexes.Add(new LwPolylineVertex(v28));
            line5.Vertexes.Add(new LwPolylineVertex(v27));
            line5.Vertexes.Add(new LwPolylineVertex(v26));
            line5.Vertexes.Add(new LwPolylineVertex(v25));
            fun.PolyFill(dxf, line5, 0.1, contour);

            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(v36));
            line6.Vertexes.Add(new LwPolylineVertex(v37));
            line6.Vertexes.Add(new LwPolylineVertex(v38));
            line6.Vertexes.Add(new LwPolylineVertex(v39));
            line6.Vertexes.Add(new LwPolylineVertex(v40));
            fun.PolyFill(dxf, line6, 0.1, contour);

            LwPolyline line7 = new LwPolyline();
            line7.Vertexes.Add(new LwPolylineVertex(v35));
            line7.Vertexes.Add(new LwPolylineVertex(v34));
            line7.Vertexes.Add(new LwPolylineVertex(v33));
            line7.Vertexes.Add(new LwPolylineVertex(v29));
            line7.Vertexes.Add(new LwPolylineVertex(v30));
            line7.Vertexes.Add(new LwPolylineVertex(v31));
            line7.Vertexes.Add(new LwPolylineVertex(v32));
            fun.PolyFill(dxf, line7, 0.1, contour);

            LwPolyline line8 = new LwPolyline();
            line8.Vertexes.Add(new LwPolylineVertex(v67));
            line8.Vertexes.Add(new LwPolylineVertex(v43));
            line8.Vertexes.Add(new LwPolylineVertex(v44));
            line8.Vertexes.Add(new LwPolylineVertex(v45));
            line8.Vertexes.Add(new LwPolylineVertex(v46));
            line8.Vertexes.Add(new LwPolylineVertex(v47));
            line8.Vertexes.Add(new LwPolylineVertex(v42));
            line8.Vertexes.Add(new LwPolylineVertex(v43));
            line8.Vertexes.Add(new LwPolylineVertex(v42));
            line8.Vertexes.Add(new LwPolylineVertex(v7));
            fun.PolyFill(dxf, line8, 0.1, contour);

            LwPolyline line9 = new LwPolyline();
            line9.Vertexes.Add(new LwPolylineVertex(v48));
            line9.Vertexes.Add(new LwPolylineVertex(v49));
            line9.Vertexes.Add(new LwPolylineVertex(v50));
            line9.Vertexes.Add(new LwPolylineVertex(v51));
            line9.Vertexes.Add(new LwPolylineVertex(v66));
            fun.PolyFill(dxf, line9, 0.1, contour);

            LwPolyline line10 = new LwPolyline();
            line10.Vertexes.Add(new LwPolylineVertex(v74));
            line10.Vertexes.Add(new LwPolylineVertex(v73));
            line10.Vertexes.Add(new LwPolylineVertex(v72));
            line10.Vertexes.Add(new LwPolylineVertex(v52));
            line10.Vertexes.Add(new LwPolylineVertex(v53));
            line10.Vertexes.Add(new LwPolylineVertex(v54));
            line10.Vertexes.Add(new LwPolylineVertex(v55));
            line10.Vertexes.Add(new LwPolylineVertex(v56));
            line10.Vertexes.Add(new LwPolylineVertex(v57));
            line10.Vertexes.Add(new LwPolylineVertex(v58));
            line10.Vertexes.Add(new LwPolylineVertex(v59));
            line10.Vertexes.Add(new LwPolylineVertex(v60));
            line10.Vertexes.Add(new LwPolylineVertex(v54));
            fun.PolyFill(dxf, line10, 0.1, contour);

            LwPolyline line11 = new LwPolyline();
            line11.Vertexes.Add(new LwPolylineVertex(v61));
            line11.Vertexes.Add(new LwPolylineVertex(v62));
            line11.Vertexes.Add(new LwPolylineVertex(v63));
            line11.Vertexes.Add(new LwPolylineVertex(v64));
            line11.Vertexes.Add(new LwPolylineVertex(v65));
            fun.PolyFill(dxf, line11, 0.1, contour);

            LwPolyline line12 = new LwPolyline();
            line12.Vertexes.Add(new LwPolylineVertex(v56));
            line12.Vertexes.Add(new LwPolylineVertex(v71));
            line12.Vertexes.Add(new LwPolylineVertex(v70));
            line12.Vertexes.Add(new LwPolylineVertex(v69));
            line12.Vertexes.Add(new LwPolylineVertex(v68));
            line12.Vertexes.Add(new LwPolylineVertex(v75));
            line12.Vertexes.Add(new LwPolylineVertex(v76));
            line12.Vertexes.Add(new LwPolylineVertex(v77));
            line12.Vertexes.Add(new LwPolylineVertex(v78));
            fun.PolyFill(dxf, line12, 0.1, contour);

            LwPolyline line13 = new LwPolyline();
            line13.Vertexes.Add(new LwPolylineVertex(v79));
            line13.Vertexes.Add(new LwPolylineVertex(v80));
            line13.Vertexes.Add(new LwPolylineVertex(v81));
            line13.Vertexes.Add(new LwPolylineVertex(v82));
            line13.Vertexes.Add(new LwPolylineVertex(v79));
            line13.Vertexes[0].Bulge = Math.Tan(-90 * pi / 180 / 4);
            line13.Vertexes[1].Bulge = Math.Tan(-83 * pi / 180 / 4);
            line13.Vertexes[2].Bulge = Math.Tan(-95 * pi / 180 / 4);
            line13.Vertexes[3].Bulge = Math.Tan(-88 * pi / 180 / 4);
            fun.PolyFill(dxf, line13, 0.1, contour);

            LwPolyline line14 = new LwPolyline();
            line14.Vertexes.Add(new LwPolylineVertex(v83));
            line14.Vertexes.Add(new LwPolylineVertex(v84));
            line14.Vertexes.Add(new LwPolylineVertex(v85));
            line14.Vertexes.Add(new LwPolylineVertex(v86));
            line14.Vertexes.Add(new LwPolylineVertex(v83));
            line14.Vertexes[0].Bulge = Math.Tan(-75 * pi / 180 / 4);
            line14.Vertexes[1].Bulge = Math.Tan(-108 * pi / 180 / 4);
            line14.Vertexes[2].Bulge = Math.Tan(-71 * pi / 180 / 4);
            line14.Vertexes[3].Bulge = Math.Tan(-105 * pi / 180 / 4);
            fun.PolyFill(dxf, line14, 0.1, contour);

            LwPolyline line15 = new LwPolyline();
            line15.Vertexes.Add(new LwPolylineVertex(v91));
            line15.Vertexes.Add(new LwPolylineVertex(v92));
            line15.Vertexes.Add(new LwPolylineVertex(v93));
            line15.Vertexes.Add(new LwPolylineVertex(v94));
            line15.Vertexes.Add(new LwPolylineVertex(v91));
            line15.Vertexes[0].Bulge = Math.Tan(-22 * pi / 180 / 4);
            line15.Vertexes[1].Bulge = Math.Tan(-129 * pi / 180 / 4);
            line15.Vertexes[2].Bulge = Math.Tan(-22 * pi / 180 / 4);
            line15.Vertexes[3].Bulge = Math.Tan(-136 * pi / 180 / 4);
            fun.PolyFill(dxf, line15, 0.1, contour);

            LwPolyline line16 = new LwPolyline();
            line16.Vertexes.Add(new LwPolylineVertex(v87));
            line16.Vertexes.Add(new LwPolylineVertex(v88));
            line16.Vertexes.Add(new LwPolylineVertex(v89));
            line16.Vertexes.Add(new LwPolylineVertex(v90));
            line16.Vertexes[0].Bulge = Math.Tan(-81 * pi / 180 / 4);
            line16.Vertexes[2].Bulge = Math.Tan(-107 * pi / 180 / 4);
            fun.PolyFill(dxf, line16, 0.1, contour);

            Line line17 = new Line(v95, v96);
            line17.Layer = refin;
            line17.Linetype = Linetype.Dashed;
            line17.LinetypeScale = 5;
            dxf.AddEntity(line17);

            Line line18 = new Line(v97, v98);
            line18.Layer = refin;
            line18.Linetype = Linetype.Dashed;
            line18.LinetypeScale = 5;
            dxf.AddEntity(line18);


            //标注

            double height = 2;
            double arrowsize = 2;
            double exline = 2;

            fun.dimrot1(dxf, v4, v13, 0, dc / 3.5, 1, height, arrowsize, exline, "OAL", "", "");

            fun.dimrot1(dxf, v95, v97, 90, oal / 2, 1, height, arrowsize, exline, "DCONMS", "", "");

            fun.dimrot1(dxf, v5, v8, 90, oal, 1, height, arrowsize, exline, "DHUB", "", "");

            fun.dimrot1(dxf, v10, v53, 90, oal * 2, 1, height, arrowsize, exline, "BD", "", "");

            fun.dimrot1(dxf, v13, v64, -90, oal * 2, 1, height, arrowsize, exline, "DC", "", "");

            fun.dimrot1(dxf, v13, new Vector2(v41.X, v85.Y), -90, oal * 2 / 3, 1, height, arrowsize, exline, "CDX", "", "");

            fun.dimrot1(dxf, v63, v77, 180, oal / 2, 1, height, arrowsize, exline, "CW", "", "");

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            Vector2 p0 = new Vector2(0, 0);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }




            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}